
//
//  DeviceManagerHeaderView.m
//  Router
//
//  Created by teki on 15/10/15.
//  Copyright © 2015年 dc. All rights reserved.
//

#import "DeviceManagerHeaderView.h"

@implementation DeviceManagerHeaderView

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/


- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self)
    {
        [self initUI];
    }
    return self;
}


- (void)initUI
{
    
    self.backgroundColor = [UIColor colorWithHexString:@"#e1f6de"];
    
    UIImageView *imgView = [UIImageView new];
    imgView.translatesAutoresizingMaskIntoConstraints = NO;
    UIImage *image = [UIImage  imageNamed:@"device_contect"];
    imgView.image = image;
    [self addSubview:imgView];
    [imgView makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(30);
        make.centerX.equalTo(self);
        make.size.equalTo(image.size);
    }];
    
    
    UILabel *label = [self addLabelWithText:@"正在连接的设备" font:[UIFont systemFontOfSize:16.0f] color:SeparatorLineColor];
    [label makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self);
        make.top.equalTo(imgView.bottom).offset(15);
    }];
    
    UIImage *normalImage = [UIImage imageNamed:@"device_backlist"];
    UIImage *selectedImage = [UIImage imageNamed:@"device_backlist_pre"];
    UIButton *blackListButton = [self addButtonWithNormalImage:normalImage selectedImage:selectedImage target:self action:@selector(blackButtonPressed:)];
    [blackListButton makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(-32);
        make.top.equalTo(30);
        make.size.equalTo(normalImage.size);
    }];
    


    UILabel *blackLabel = [self addLabelWithText:@"黑名单" font:    [UIFont systemFontOfSize:12.0f] color:    SeparatorLineColor];
    [blackLabel makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(blackListButton);
        make.top.equalTo(blackListButton.bottom).offset(5);
    }];
    
}




- (void)blackButtonPressed:(UIButton *)sender
{
    
}
@end
